package com.qpx.eurekajpa.controller;


import com.qpx.dto.UserDto;
import com.qpx.eurekajpa.config.Log;
import com.qpx.eurekajpa.dao.UserDao;
import com.qpx.eurekajpa.entity.UserEntity;
import com.qpx.eurekajpa.service.UserService;
import com.qpx.vo.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "用户信息")
@Slf4j
public class UserController {

    @Autowired
    UserService userService;
    @RequestMapping(value = "/user/list",method = RequestMethod.GET)
    @ApiOperation(value = "查询用户列表")
    @Log("查询用户列表")
    public ResultEntity getUserAll(UserDto userDto){
        Page<UserEntity> all = userService.findAll(userDto);
        return ResultEntity.ok("查询成功","200",all);
    }

    @RequestMapping(value = "/user/save",method = RequestMethod.POST)
    @ApiOperation(value = "保存用户")
    public ResultEntity saveUser(UserDto userDto){
        log.info("---------------------------------------------------------");
        return  ResultEntity.ok();

    }
}
